package javacafe.action.noticeboard;

import java.util.List;

import javacafe.action.Action;
import javacafe.action.ActionForward;
import javacafe.dto.bbspost.BbsPostDTO;
import javacafe.dto.event.WorkshopDTO;
import javacafe.serviceimple.BbsPostServiceImple;
import javacafe.serviceimple.WorkshopServiceImple;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class DeleteNoticeAction implements Action {

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) {
		// TODO Auto-generated method stub
		ActionForward actfoward = new ActionForward();		
		BbsPostServiceImple service = BbsPostServiceImple.getInstance();
		List<BbsPostDTO> list = null;
		BbsPostDTO dto = new BbsPostDTO();		
		
		String bp_no = request.getParameter("seq");
		
		dto.setBp_no(Integer.parseInt(bp_no));
		
		dto = service.getBbsPost(dto);
		
		dto.setBp_delflag(1);
		service.updateBbsPost(dto);
		
		list = service.getBbsPostList(dto);
				
		request.setAttribute("list",list);
		actfoward.setUrl("noticeboard");
		return actfoward;
	}

}
